﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
using Zj.DDDSample.Domain.Core;
using Zj.DDDSample.Repositories.EntityFrameworkCore.Models.Mappings;

namespace Zj.DDDSample.Repositories.EntityFrameworkCore.Models
{
    /// <summary>
    /// Project database context.
    /// </summary>
    public class ProjectDbContext
        :DbContext
    {
        public ProjectDbContext(DbContextOptions<ProjectDbContext> options)
            :base(options)
        {

        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.ApplyConfiguration<Project>(new ProjectMap());
            modelBuilder.ApplyConfiguration<Item>(new ItemMap());
        }

        public virtual DbSet<Project> Project { get; set; }
        public virtual DbSet<Item> Item { get; set; }
    }
}
